@charset "utf-8";

@import '../variable';

/**
 *
 * @Checkbox.css
 * @author zhangxinxu
 * @create 15-06-18
 * @edit 17-06-14  focusable
**/

input[type=checkbox] {
	position: absolute;
	opacity: 0;
	width: 20px; height: 20px;
	filter: alpha(opacity=0);
	cursor: pointer;
	z-index: -1;
}

/* 无绝对定位的模拟生成实现 */
.ui-checkbox {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 1px solid rgba(0,0,0,0);
	border-radius: $borderRadius;
	box-sizing: border-box;
	box-shadow: inset 0 1px, inset 1px 0, inset -1px 0, inset 0 -1px;
	background-color: $white;
	background-clip: content-box;
	color: $borderNormal;
	-webkit-transition: color .2s, background-color .1s;
    transition: color .2s, background-color .1s;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
	vertical-align: -5px;
	*vertical-align: 0;
	overflow: hidden;
}

:not(:disabled) + .ui-checkbox:hover,
:disabled + .ui-checkbox {
	color: $borderHover;
}

:focus + .ui-checkbox {
	color: $borderFocus;
}
:checked:focus + .ui-checkbox {
    color: $darkblue;
    background-color: $darkblue;
}

:checked + .ui-checkbox,
:checked + .ui-checkbox:hover {
	color: $borderFocus;
	background-color: $backgroundBlue;
}

.ui-checkbox::after {
	content: '';
	display: block;
	width: 100%;
	height: 100%;
	background: url() no-repeat center;
	background-size: 20px 20px;
	visibility: hidden;
}
:checked + .ui-checkbox::after {
	visibility: visible;
	-webkit-animation: bounceIn .2s;
	animation: bounceIn .2s;
}

:disabled + .ui-checkbox {
	opacity: .38;
}

/* error */
.error.ui-checkbox {
	color: $red;
}

/*IE7, IE8 使用图片作UI*/
@media \0screen\,screen\9 {
	.ui-checkbox {
		background: url(#{$urlImage}/Checkbox/checkbox.png) no-repeat;
	}
	.ui-checkbox:hover {
		background-position: 0 -20px;
	}
	[checked] + .ui-checkbox,
	[checked][disabled] + .ui-checkbox {
		background-position: 0 -40px;
	}
	[defaultChecked] + .ui-checkbox,
	[defaultChecked][disabled] + .ui-checkbox {
		background-position: 0 -40px;
	}
	[disabled] + .ui-checkbox {
		/* disabled态使用高亮边框 */
		background-position: 0 -20px;
		filter: alpha(opacity=38);
	}
}
